package com.momo.mapper.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.momo.mapper.dataobject.ItemDO;
import com.momo.mapper.mapper.ItemDOMapper;

/**
* The Table ITEM.
* 注意:此结构有系统生成,禁止手工修改,以免被覆盖,请通过dalgen生成
* ITEM
*/
@Repository
public class ItemDAO{

    @Autowired
    private ItemDOMapper itemDOMapper;

    /**
     * desc:插入表:ITEM.<br/>
     * descSql =  SELECT LAST_INSERT_ID() INSERT INTO ITEM( TITLE ,IMG_URL ,DESCRIPTION ,SALES ,PRICE )VALUES( #{title,jdbcType=VARCHAR} ,#{imgUrl,jdbcType=VARCHAR} ,#{description,jdbcType=VARCHAR} ,#{sales,jdbcType=INTEGER} ,#{price,jdbcType=DECIMAL} )
     * @param entity entity
     * @return int
     */
    public int insert(ItemDO entity){
        return itemDOMapper.insert(entity);
    }
    /**
     * desc:更新表:ITEM.<br/>
     * descSql =  UPDATE ITEM SET TITLE = #{title,jdbcType=VARCHAR} ,IMG_URL = #{imgUrl,jdbcType=VARCHAR} ,DESCRIPTION = #{description,jdbcType=VARCHAR} ,SALES = #{sales,jdbcType=INTEGER} ,PRICE = #{price,jdbcType=DECIMAL} WHERE ID = #{id,jdbcType=INTEGER}
     * @param entity entity
     * @return int
     */
    public int update(ItemDO entity){
        return itemDOMapper.update(entity);
    }
    /**
     * desc:根据主键删除数据:ITEM.<br/>
     * descSql =  DELETE FROM ITEM WHERE ID = #{id,jdbcType=INTEGER}
     * @param id id
     * @return int
     */
    public int deleteById(Integer id){
        return itemDOMapper.deleteById(id);
    }
    /**
     * desc:根据主键获取数据:ITEM.<br/>
     * descSql =  SELECT * FROM ITEM WHERE ID = #{id,jdbcType=INTEGER}
     * @param id id
     * @return ItemDO
     */
    public ItemDO getById(Integer id){
        return itemDOMapper.getById(id);
    }
}
